//
//  YYConsts.h
//  Yoyord
//
//  Created by 向的MacBook on 15/10/1.
//  Copyright © 2015年 yoyo. All rights reserved.
//

#ifndef YYConsts_h
#define YYConsts_h

#define SERVER  2


#if(SERVER == 1)//pre后台
const static NSString * YY_YOYOORD_URL = @"http://test.a.yoyosports.cn";//@"http://dev.sochat.cc";

#define kYoYoXiaoMiRoomID @"5628975100b0a6792bf0166d"

#elif(SERVER == 2)//正式版

//const static NSString * YY_BIZCARD_URL = @"http://dev.sochat.cc";

const static NSString * YY_YOYOORD_URL = @"http://a.yoyosports.cn";// @"http://dev.sochat.cc";
#define kYoYoXiaoMiRoomID @"5629f17e00b0d1db62670d09"

//kYYDeveloperMode 

#endif



//#define PRI_KEY @"a92a32bcbae61c4f09da0eff0ff66acd6dba";
#pragma mark - 网络请求后缀------------------------------------





#pragma mark - Documents文件夹
#define DOCUMENTS_FOLDER [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]

#define DB_DOCUMENT_PATH [DOCUMENTS_FOLDER stringByAppendingPathComponent:[NSString stringWithFormat:@"%lld",[YYUserSession sharedInstance].userId]]  //!<数据库文件所在目录
#define PATH_CACHE_FOLDER [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches"]
#define PATH_MAPS_FOLDER [PATH_CACHE_FOLDER stringByAppendingPathComponent:@"maps"]

#pragma mark - 图片缓存文件夹
#define IMAGECACHE_FOLDER [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches/ImageCache"]

#pragma mark - IOS8及以上系统
#define IOS8 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0000 ? YES : NO)


#pragma mark - 是否4英寸屏
#define IS_4INCH ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#pragma mark - 是否是3.5英寸
#define DEVICE_IS_IPHONE4 ([[UIScreen mainScreen] bounds].size.height == 480)

#define iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)

#define isLargerIphone (([[UIScreen mainScreen] currentMode].size.height > 960.f) ? YES : NO)
#define SCREEN_WIDTH CGRectGetWidth([UIScreen mainScreen].bounds)
#define SCREEN_HEIGHT CGRectGetHeight([UIScreen mainScreen].bounds)

#define NAVIGATIONBAR_HEIGHT 44.0f
#define STATUBAR_HEIGHT 20.0f
#define TABBAR_HEIGHT 49.0f
#define SCREEN_SCALE SCREEN_WIDTH/320.0f

//分割线的颜色
#define kSeporatorLineColor UIColorFromRGB(0xd5d5d5)





#pragma mark - shortcuts

#define GetImageWithPath(name) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:name ofType:@"png"]]
#define GetImageJPGWithPath(name) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:name ofType:@"jpg"]]

#define UIColorFromRGB(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

//RGB color macro with alpha
#define UIColorFromRGBWithAlpha(rgbValue,a) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:a]




#define GCD_GLOBAL_QUEUE dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
#define SystemName            [[UIDevice currentDevice] systemName]
#define SystemVersion         [[[UIDevice currentDevice] systemVersion] floatValue]

#define APP_VERSION      [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]//@"5.3"
#define SIGN_SECRET @"b905a263b1d0c4b7a7df040a253be3b0"

#define IOS6_7_DELTA(V,X,Y,W,H) {CGRect f = V.frame;f.origin.x += X;f.origin.y += Y;f.size.width +=W;f.size.height += H;V.frame=f;}


#pragma mark - common functions
#define YY_SINGLETION(__clazz) \
+ (__clazz *)sharedInstance;

#define YY_DEF_SINGLETION(__clazz) \
+ (__clazz *)sharedInstance \
{\
static dispatch_once_t once; \
static __clazz * __singletion;\
dispatch_once(&once,^{__singletion = [[__clazz alloc] init];});\
return __singletion;\
}

#define dispatch_main_sync_safe(block)\
if ([NSThread isMainThread])\
{\
block();\
}\
else\
{\
dispatch_sync(dispatch_get_main_queue(), block);\
}

#define RGBCOLOR(r,g,b) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1]

#define RGBACOLOR(r,g,b,a) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)]

#define UIColorFromRGB(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

//RGB color macro with alpha
#define UIColorFromRGBWithAlpha(rgbValue,a) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:a]

#define kColorOfNavigation  RGBACOLOR(64, 71, 81, 1)

#define BOLD_FONT(num) [UIFont boldSystemFontOfSize: num]
#define SYSTEM_FONT(num) [UIFont systemFontOfSize: num]

#define APP_DELEGATE (AppDelegate *)[[UIApplication sharedApplication] delegate];

#ifndef IS_IPHONE
#define IS_IPHONE ( [ [ [ UIDevice currentDevice ] model ] isEqualToString: @"iPhone" ] )
#endif

#ifndef IS_IPOD
#define IS_IPOD   ( [ [ [ UIDevice currentDevice ] model ] isEqualToString: @"iPod touch" ] )
#endif

#ifndef IS_WIDESCREEN
#define IS_WIDESCREEN ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )
#endif

#ifndef IS_IPHONE_5
#define IS_IPHONE_5 ( IS_IPHONE && IS_WIDESCREEN )
#endif

#ifndef IS_IPAD
#define IS_IPAD ( [ [ [ UIDevice currentDevice ] model ] isEqualToString: @"iPad" ] ||  [ [ [ UIDevice currentDevice ] model ] isEqualToString: @"iPad Simulator" ])
#endif

#ifdef DEBUG
#   define YYDebug(YYt, ...) NSLog((@"%s [Line %d] " YYt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#   define YYDebug(...)
#endif

#   define YYLog(YYt, ...) NSLog((@"%s [Line %d] " YYt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);

#ifndef YY_STRONG
#if __has_feature(objc_arc)
#define YY_STRONG strong
#else
#define YY_STRONG retain
#endif
#endif

#define SUPPRESS_PERFORM_SELECTOR_LEAK_WARNING(code)                    \
_Pragma("clang diagnostic push")                                        \
_Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"")     \
code;                                                                   \
_Pragma("clang diagnostic pop")



#endif


#ifdef RELEASE

#define NSLog(...); {}


#define SuppressPerformSelectorLeakWarning(Stuff) \
do { \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \
Stuff; \
_Pragma("clang diagnostic pop") \
} while (0)




#endif /* YYConsts_h */
